home *** CD-ROM | disk | FTP | other *** search
- Path: news-m01.ny.us.ibm.net!usenet
- From: hopkinc@ibm.net
- Newsgroups: comp.lang.pl1,comp.lang.c
- Subject: Re: PL/I and C
- Date: 28 Feb 1996 11:13:02 GMT
- Message-ID: <4h1dbu$3g4g@news-s01.ny.us.ibm.net>
- References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <4grhtv$s31@goanna.cs.rmit.EDU.AU> <4gt0tv$826@solutions.solon.com> <4gv8h0$3o2k@news-s01.ny.us.ibm.net> <4h066c$r0t@solutions.solon.com>
- Reply-To: Chris_harlow@artemis-intl.com
- NNTP-Posting-Host: slip139-92-21-74.lo.uk.ibm.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4h066c$r0t@solutions.solon.com>, seebs@solutions.solon.com (Peter Seebach) writes:
- >(not sure what the punctuation is). Looks like a trivial operation, generates
- >nontrival code. (Sort of like the hidden overhead of structure assignment
- >in C.)
-
- Depends what you call non-trivial code and what kind of strings you are assigning
- and their relative declared lengths. In any case, the complexity of the generated
- code is of indifference to me, I care rather for the speed at which it
- eventually executes. (Isnt this why we have compilers?)
- >
- > I've seen a *portable* C implementation of strfoo()
- >outperform the single-instruction way to do it on the Pentium - because
- >the C implementation was smarter than the P5. You don't have to use
- >a feature just because it's there.
- >
- If the compiler's wrong, its wrong. My point is that if your language is too
- low level it can prevent the compiler using the best available methods.
- (I suspect that this may be why FORTRAN is still used so extensively for
- massive number crunching.. because there are no pointers in the language, the
- compiler can know about all possible side-effects and therefore do a better
- job at optimisation... anyone out there know this for sure??)
- >Are you telling me PL/I can't have a non-fixed length string, dynamically
- >allocated? If it can, the compare or copy functionality will do the same
- >thing strcmp() and strcpy() do at some level.
-
-
- PL/1 can do this just fine, but the same advantages apply, the PL/1 equivalent
- of strlen() is still just a single load instruction (variable length strings in PL/1
- have a 2 byte prefix containing the current length, fixed length strings have
- length known by the compiler) and therfore any compare
- or move can be performed by the fasted available machine instructions without
- having to test each byte for \0
-
-
-
- .. dont get me wrong, I write in PL/1 (mainframe and OS/2), assembler, C,
- VB, delphi etc and they all have their advantages.....
-
- I just think its a shame that:
- (a) C got so hyped because it was essentially free when in fact it lacked
- a great deal of power that other languages took fro granted.
- (b) The PL/1 guys too sooooooo long to copy the good bits of C into PL/1 and
- to start shipping it on the small platforms.
-
- (c) So many clever programmers have to spend their time worrying about the
- details or merits of different languages when they could be writing great
- products.!!!
-
-
-